﻿@model iChip.Hotspots.Models.FieldModel
@{
    Layout = null;
}

@if (Model != null && Model.Fields.Count > 0)
{
    foreach (var item in Model.Fields)
    {
        <div class="form-inline">
            <form class="form-inline">
                <div class="form-group">
                    @Html.TextBoxFor(m => item.Field_Name, new { placeholder = "VD: Email của bạn", @class = "form-control", Name = "Field_Name" })
                    @*<input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email">*@
                </div>
                <div class="form-group">
                    @Html.DropDownListFor(m => item.FieldType_Id, new SelectList(Model.Field_Type,"Value","Text",item.FieldType_Id), new { @class = "form-control", Name = "Field_Type" })
                    @Html.TextBoxFor(m => item.FieldType_Id, new { @class = "form-control hidden"})
                </div>
                <div class="checkbox form-group">
                    <label>
                        @Html.CheckBoxFor(m => item.Field_IsRequire, new { Name = "Field_IsRequire" }) Bắt buộc
                    </label>
                </div>
                @Html.TextBoxFor(m => item.Field_Id, new { @class = "form-control hidden", Name = "Field_Id" })
                <button type="button" class="btn btn-danger" style="float:right" data-field-id="@item.Field_Id" onclick="DelField(this)">Xóa</button>
                <button type="button" class="btn btn-success hidden" style="float:right" data-field-id="@item.Field_Id" onclick="AddFieldValue(this)">Giá trị</button>
            </form>
            <hr />
        </div>
    }
}
else
{
     <div class="form-inline">
            <form class="form-inline">
                <div class="form-group">
                    @Html.TextBox("Field_Name", null, new { placeholder = "Field Name", @class = "form-control", Name = "Field_Name" })
                    @*<input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email">*@
                </div>
                <div class="form-group">
                    @Html.DropDownList("FieldType_Id", Model.Field_Type, new { @class = "form-control", Name = "Field_Type" })
                    @Html.TextBox("FieldType_Id", null, new { @class = "form-control hidden" })
                </div>
                <div class="checkbox form-group">
                    <label>
                        @Html.CheckBox("Field_IsRequire", new { Name = "Field_IsRequire" }) Bắt buộc
                    </label>
                </div>
                @Html.TextBox("Field_Id",null, new { @class = "form-control hidden", Name = "Field_Id" })
                <button type="button" class="btn btn-danger" style="float:right" data-field-id="0" onclick="DelField(this)">Xóa</button>
                <button type="button" class="btn btn-success hidden" style="float:right" data-field-id="0" onclick="AddFieldValue(this)">Giá trị</button>
            </form>
            <hr />
        </div>
}
